package com.karson.service.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.karson.common.constants.Constants;
import com.karson.common.exception.AsmrException;
import com.karson.common.model.AlbumAuthor;
import com.karson.common.model.TagInfo;
import com.karson.common.response.AlbumResponse;
import com.karson.service.dao.AlbumInfoMapper;
import com.karson.service.service.AlbumAuthorService;
import com.karson.service.dao.AlbumAuthorMapper;
import com.karson.service.service.AlbumInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Stream;

/**
* @author ZKS
* @description 针对表【ar_album_author】的数据库操作Service实现
* @createDate 2025-08-06 14:08:23
*/
@Service
public class AlbumAuthorServiceImpl extends ServiceImpl<AlbumAuthorMapper, AlbumAuthor>
    implements AlbumAuthorService{
    @Override
    public List<Integer> getAuthorListWithAlbumId(Integer albumId) {
        LambdaQueryWrapper<AlbumAuthor> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(AlbumAuthor::getAlbumId, albumId);
        List<AlbumAuthor> list = list(wrapper);
        return list.stream().map(AlbumAuthor::getAuthorId).toList();
    }

    @Override
    public List<Integer> getAlbumsByAuthorIds(List<Integer> idList) {
        LambdaQueryWrapper<AlbumAuthor> wrapper = new LambdaQueryWrapper<>();
        wrapper.in(AlbumAuthor::getAlbumId, idList);
        List<AlbumAuthor> list = list(wrapper);
        return list.stream().map(AlbumAuthor::getAlbumId).toList();
    }

}




